package com.zhengke.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zhengke.common.object.Result;
import com.zhengke.dao.kcgl.InventoryManageMapper;
import com.zhengke.pojo.Inventory;
import com.zhengke.service.InventoryManageService;

@Service
public class InventoryManageServiceImpl implements InventoryManageService{

	@Autowired
	private InventoryManageMapper dao;
	
	public Result findInventory(String goods_name,Integer is_normal,int limit,int page) {
		Map<String, Object> paraMap = new HashMap<String, Object>();
		
		paraMap.put("goods_name",goods_name);
		paraMap.put("is_normal",is_normal);
		PageHelper.startPage(page, limit, true);
		List<Inventory> list=dao.findInventory(paraMap);
		
		PageInfo<Inventory> pageInfo =new PageInfo<Inventory>(list);
		 Result rs = new Result();
		rs.setCode("0");
		rs.setCount(pageInfo.getTotal());
		rs.setData(list);
		rs.setMsg("success");
		return rs;
	}

	
	
	
	
}
